/**
 * 
 */
package weather.util;

import static org.junit.Assert.*;

import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.*;

/**
 * Test class for {@link weather.util.Dates}
 * @author Jerzy Mazurek WEiTI PW
 */
public class DatesTest
{
	/**
	 * Test method for {@link weather.util.Dates#numberOfDaysBetween(java.util.Date, java.util.Date)}.
	 */
	@Test
	public void testNumberOfDaysBetween()
	{
		assertEquals(0, Dates.numberOfDaysBetween(
				DATE_10_OCT_2000, DATE_10_OCT_2000));
		assertEquals(4, Dates.numberOfDaysBetween(
				DATE_10_OCT_2000, DATE_14_OCT_2000));
		assertEquals(-4, Dates.numberOfDaysBetween(
				DATE_14_OCT_2000, DATE_10_OCT_2000));
		assertEquals(0, Dates.numberOfDaysBetween(
				DATE_15_JUN_2000, DATE_15_JUN_2000));
		assertEquals(-10, Dates.numberOfDaysBetween(
				DATE_15_JUN_2000, DATE_05_JUN_2000));
		assertEquals(10, Dates.numberOfDaysBetween(
				DATE_05_JUN_2000, DATE_15_JUN_2000));
	}

	private static final DateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");
	private static final DateFormat complexDateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS");
	private static final Date DATE_10_OCT_2000 = complexDateFormat.parse("10.10.2000 14:34:34.123", new ParsePosition(0));
	private static final Date DATE_14_OCT_2000 = simpleDateFormat.parse("14.10.2000", new ParsePosition(0));
	private static final Date DATE_05_JUN_2000 = simpleDateFormat.parse("05.06.2000", new ParsePosition(0));
	private static final Date DATE_15_JUN_2000 = simpleDateFormat.parse("15.06.2000", new ParsePosition(0));
}
